<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Lemon
  Date: 2020/6/18
  Time: 9:25
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>搜索页面</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/layui/css/layui.css">
</head>
<body>
<%--layui-form  layui的表单样式，添加到form表单上--%>
<form class="layui-form">
    <div style="width: 99.8%;height: 35px;line-height: 35px;border: 1px #f1f1f1 solid;background-color: #f5f5f5">
        <span style="margin-left: 28px;">搜索条件</span>
    </div>
    <%--一个表单项--%>
    <div class="layui-form-item" style="margin-top: 40px">
        <label class="layui-form-label">客户：</label>
        <%--layui-input-inline 行内 block 占整行--%>
        <div class="layui-input-inline" style="width: 250px">
            <%--lay-verify="required" 必填项--%>
            <select name="customer_id">
                <option>请选择</option>
                <c:forEach items="${service}" var="customer">
                    <option value="${customer.customer_id}">${customer.customer_name}</option>
                </c:forEach>
            </select>
        </div>
    </div>
    <hr>
    <div class="layui-form-item" style="margin-top: 40px">
        <label class="layui-form-label">服务类型：</label>
        <div class="layui-input-inline" style="width: 250px">
            <select name="type">
                <option>请选择</option>
                <option>投诉</option>
                <option>咨询</option>
                <option>售后</option>
                <option>售前</option>
                <option>售中</option>
            </select>
        </div>
        <label class="layui-form-label" style="margin-left: 80px">紧急程度：</label>
        <div class="layui-input-inline" style="width: 250px">
            <select name="emergency">
                <option>请选择</option>
                <option>非常紧急</option>
                <option>紧急</option>
                <option>一般</option>
            </select>
        </div>
    </div>
    <hr>
    <div class="layui-form-item" style="margin-top: 40px">
        <label class="layui-form-label" >服务状态：</label>
        <div class="layui-input-inline" style="width: 250px">
            <select name="status">
                <option>请选择</option>
                <option>未处理</option>
                <option>处理中</option>
                <option>已处理</option>
                <option>已归档</option>
            </select>
        </div>
        <label class="layui-form-label" style="margin-left: 60px;width: 100px">客户满意度：</label>
        <div class="layui-input-inline" style="width: 250px">
            <select name="degree">
                <option>请选择</option>
                <option>☆</option>
                <option>☆☆</option>
                <option>☆☆☆</option>
                <option>☆☆☆☆</option>
                <option>☆☆☆☆☆</option>
            </select>
        </div>
    </div>
    <div class="layui-form-item" style="margin-top: 80px">
        <%--lay-submit 标识该按钮可以提交表单--%>
        <input type="reset" style="margin-left:350px" class="layui-btn layui-btn-warm" value="重置">
        <input type="button" lay-filter="select" lay-submit class="layui-btn" value="搜索">
    </div>
</form>
<%--引入js--%>
<script src="${pageContext.request.contextPath}/static/layui/layui.js"></script>
<script>
    //layui引入特定模块的方式
    layui.use(['layer', 'form','jquery','layedit'], function(){
        var layer = layui.layer//layer 弹窗对象
            ,form = layui.form;//表单对象
        var $=layui.$;//jquery对象

        //表单提交监听
        form.on("submit(select)",function (data) {
            console.log(data.field);
            //发起异步请求，新增 data.field 表单数据
            $.post("${pageContext.request.contextPath}/service/list",function (result) {
                if (result.code==0){
                    //刷新父窗口的表格 parent 父窗口对象
                    parent.layui.table.reload("serviceTable",{
                        where:{//查询条件
                            params:data.field//会封装到LayRequest中的params中去
                        },
                        page:{
                            curr:1
                        }
                    })
                    //关闭本窗口
                    //当你在iframe页面关闭自身时
                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    parent.layer.close(index); //再执行关闭
                }
                    else {
                        layer.msg("数据加载中");
                }
            },"json");
            return false;//阻止表单跳转。如果需要表单跳转，去掉这段即可。
        })
    });
</script>
</body>
</html>
